angularJs学习5: 操作html的Dom

实例一

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<html>
<head>
<meta charset="utf-8">
<script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<body>

<div ng-app="" ng-init="mySwitch=true">
<p>
<button ng-disabled="mySwitch">点我!</button>
</p>
<p>
<input type="checkbox" ng-model="mySwitch"/>按钮
</p>
<p>
{{ mySwitch }}
</p>
</div>

</body>
</html>

示例2 show指令 hide指令

1
2
3
4
5
6
7
<p ng-show="true">我是可见的。</p>

<p ng-show="false">我是不可见的。</p>

<div ng-app="" ng-init="hour=11">

<p ng-show="hour > 12">我是可见的。</p>